package mapper.base;

import org.apache.ibatis.annotations.Mapper;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface BaseMapper<T> {
    /**
     * 添加记录不返回主键
     * @param entity
     * @return
     * @throws DataAccessException
     */
    int insert(T entity) throws DataAccessException;

    /**
     * 删除记录
     * @param id
     * @return
     */
    int delete(Integer id) throws DataAccessException;

    /**
     * 更新记录
     * @param entity
     * @return
     */
    int update(T entity) throws DataAccessException;

    /**
     * count
     * @return
     */
    int count() throws DataAccessException;

    List<T> query(String sql, Map<String, Object> params) throws DataAccessException;
}
